<!--
 * @Description: 
 * @Author: charles
 * @Date: 2021-06-17 18:22:00
 * @LastEditors: charles
 * @LastEditTime: 2021-06-17 18:33:23
-->
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>回调函数</title>
</head>
<body>
  <script>
    var arr = [{
      name:"terry",
      age:1,
      gender:"male"
    },{
      name:"vicky",
      age:2,
      gender:"female"
    },{
      name:"tom",
      age:2,
      gender:"male"
    }]

    for(var i = 0;i<arr.length;i++){
      console.log(arr[i]);
    }
    console.log("-------------")
    arr.forEach(function(item,index){
      console.log(index,item);
    })
    console.log("============")
    arr.forEach((index,item) => {
      console.log(index,item);
    })

    // let result = arr.every(function(item){
    //   return item.gender == "male"
    // })
    let result = arr.every(item => item.gender == "male")

    console.log("性别都为male?",result);



  </script>
</body>
</html>